function xcorrout()
%
% write out the xcorr data from the first selected record in the list.
% kludge 12/27/05.
%
global XCRESULT
global CONTROL

sf = getmainselection;
sf = sf(1); % just the first...

fn = CONTROL(sf).filename;

h = fopen (sprintf('/users/pmanis/Desktop/%s_%d.txt', fn, CONTROL(sf).recbeg), 'w');
fprintf(h, '%s  spike xcorr\n', fn);
x = XCRESULT(sf).lags;
cx = XCRESULT(sf).cx;
x = x(4500:5500);
xs = XCRESULT(sf).lags2;
cs = XCRESULT(sf).cx2;

for i = 1:length(x)
    fprintf(h, '%f %f %f %f\n', x(i), cx(i), xs(i), cs(i));
end;
fclose(h);


